package com.fy.controller;


import com.fy.dao.Ce_infoMapper;
import com.fy.entity.Ce_info;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/ceinfo")
public class Ce_infoController {
    String id="1";
    @Resource
    Ce_infoMapper ce_infoMapper;
    @GetMapping("/getAll")
    public List<Ce_info> ce_infoMapper(){
        return ce_infoMapper.findAll();
    }
    @PostMapping("/getInfo")
    public List<Ce_info> ce_info(String ce_id){
        List<Ce_info> co=ce_infoMapper.getInfo(ce_id);
        return co;
    }
    @PostMapping("/insert")
    public String insert(String ce_id,String ce_pic,String ce_name,String info_id,String ce_info){
        ce_infoMapper.insert_ce_info(id,ce_pic,ce_name,info_id,ce_info);
        id=(Integer.valueOf(id)+1+"");
        return "200";
    }
    @PostMapping("/delete")
    public String delete(String ce_id){
        ce_infoMapper.delete_ce_info(ce_id);
        return "200";
    }
}
